Skip to content

SDK-563 make preferUserId configurable#578

Merged
joaodordio merged 2 commits into
mainfrom
SDK-563/preferUserId-configurable
Jul 16, 2026
Merged

SDK-563 make preferUserId configurable#578
joaodordio merged 2 commits into
mainfrom
SDK-563/preferUserId-configurable

Conversation

@jena-chakour

@jena-chakour jena-chakour commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

JIRA Ticket(s) if any

Description

Make preferUserId configurable.

Test Steps

Previously the SDK hardcoded preferUserId: true on users/update, commerce
updateCart, and trackPurchase requests, overriding any value the caller passed.
Now it uses `payload.preferUserId ?? true` (and `payload.user?.preferUserId ?? true`
for the nested commerce user), so callers can opt out while the default stays true.
@jena-chakour
jena-chakour requested a review from mprew97 as a code owner July 13, 2026 22:08
@jena-chakour jena-chakour changed the title Sdk 563/prefer user id configurable SDK-563/preferUserId-configurable Jul 13, 2026

@nunolourenco-itrbl nunolourenco-itrbl left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look right. I tested them on react example and I witnessed that:

  • not sending preferUserId still defaults to preferUserId: true
  • explicitly sending preferUserId as true or false works

@joaodordio joaodordio left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@joaodordio joaodordio changed the title SDK-563/preferUserId-configurable SDK-563 make preferUserId configurable Jul 16, 2026

@nunolourenco-itrbl nunolourenco-itrbl left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to merge!

Comment thread src/commerce/commerce.ts
...payload.user,
preferUserId: true
/* default to true, but allow the caller to override */
preferUserId: payload.user?.preferUserId ?? true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@joaodordio
joaodordio merged commit 6bbb6ce into main Jul 16, 2026
6 checks passed
@joaodordio
joaodordio deleted the SDK-563/preferUserId-configurable branch July 16, 2026 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants